package com.cruise.oauth.util;

/**
 * 类名：PasswordEncoder
 * 描述：TODO
 * @author cruise
 * 日期：2021/1/17 上午2:18
 * 版本：1.0
 **/

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;

public class PasswordEncoder {

    public static void main(String[] args) {
        org.springframework.security.crypto.password.PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
        String password = "111";
        String password2 = encoder.encode(password);
        System.out.println(password2);
        System.out.println(encoder.matches(password, password2));

        BCryptPasswordEncoder encoder2 = new BCryptPasswordEncoder();
        String password3 = encoder2.encode(password);
        System.out.println(password3);

        BCryptPasswordEncoder encoder3 = new BCryptPasswordEncoder();
        System.out.println(encoder3.matches(password, password3));
    }

}


